package org.example.qweqq.validation;

import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
import org.example.qweqq.anno.State;

public class StateValidation implements ConstraintValidator<State, String> {
    /**
     * @param value 将来校验的数据
     * @param context sd
     *
     * @retrun 返回false 校验不通过 true 校验通过
     *
     */
    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        //提供校验规则
        if(value == null){
            return false;
        }
        if(value.equals("已发布")||value.equals("草稿")){
            return true;
        }

        return false;
    }
}
